<?php
session_start();
include "../../public/common/common.php";
include "../../public/common/config.php";

?>
<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8" />
		<title></title>
	</head>
	<body>
		<?php
		include "../header.php"	
		?>
		
		<div class="content">
			<div class="floor">
				<div class="floorHeader">
					<div class="left">
						<span id="">
							我的购物车
						</span>
					</div>
				</div>
				<div class="floorFooter2">
					<table>
						<tr>
							<th>商品</th>
							<th>图片</th>
							<th>价格</th>
							<th>库存</th>
							<th>数量</th>
							<th>合计</th>
							<th>删除</th>
						</tr>
						
						<?php
						$total = 0;	
						if(count($_SESSION['shops']) == 0){
							echo "<tr><td colspan='7'>你还没购买任何商品，请先购物 <a href='../index.php'>购物</a></td></tr>";
						}else{
							foreach($_SESSION['shops'] as $shop){
								$total += $shop['price'] * $shop['num'];
						?>
						
								<tr>	
									<td><?php echo $shop['name']?></td>
									<td>
										<img src="<?php echo $imgPath . '/thumb_' . $shop['name']?>"/>
									</td>
									<td><?php echo $shop['price']?>元</td>
									<td><?php echo $shop['stock']?></td>
									<td>
										<a href="cut.php?id=<?php echo $shop['id']?>" class='cartNum'>-</a>
										<span id="">
											<?php echo $shop['num']?>
										</span>
										<a href="add.php?id=<?php echo $shop['id']?>" class='cartNum'>+</a>
									</td>
									<td>
										<?php echo $shop['price'] * $shop['num']?>元
									</td>
									<td>
										<a href="delete.php?id=<?php echo $shop['id']?>" class="cartDel">删除</a>
									</td>
								</tr>
						
						<?php
							}	
						}
						?>	
							
						<tr>
							<td colspan="2"><a href="../index.php">继续购物</a></td>
							<td colspan="2"><a href="clear.php">清空购物车</a></td>
							<td>&nbsp;</td>
							<td>总合计：</td>
							<td><?php echo $total?>元</td>
						</tr>
					</table>
					
				</div>
			</div>
			
			<div class="floor">
				<div class="floorHeader">
					<div class="left">
						<span id="">
							我的联系方式：
						</span>
					</div>
				</div>
				<div class="floorFooter2">
					<?php
					if(isset($_SESSION['home_userid'])){
					?>
					<table border="" cellspacing="" cellpadding="">
						<tr>
							<th>选择</th>
							<th>姓名</th>
							<th>地址</th>
							<th>电话</th>
							<th>邮箱</th>
						</tr>
						<tr>							
							<td>
								<input type="radio" name="" id="" value="" />
							</td>
							<td>Data</td>
							<td>Data</td>
							<td>Data</td>
							<td>Data</td>
						</tr>
					</table>
					<?php	
					}else{
						echo "你还未登录，请先登录，<a href='../login.php' >登录</a>";
					}
					?>									
				</div>
			</div>
			
		</div>
		

	</body>
	
</html>